﻿using Ljy_VoteSys.Models.Database;
using Ljy_VoteSys.Service;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Ljy_VoteSys.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class testController : ControllerBase
    {
        //注入jwt服务
        private readonly IJWTService _jwtService;
        //定义数据库上下文
        private readonly Ljy_VoteSysContext _db;

        public testController(IJWTService jwtService, Ljy_VoteSysContext db)
        {
            _jwtService = jwtService;
            _db = db;
        }

        [HttpGet]
        public string CreateToken(string name)
        {
            //返回  通过用户名 创建token
            return _jwtService.CreateToken(name, 0);
        }

        //注册用户
    }
}
